
<!-- saved from url=(0085)http://api.map.baidu.com/library/InfoBox/1.2/docs/symbols/src/BMapLib_InfoBox.js.html -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class="line">  1</span> <span class="COMM">/**
<span class="line">  2</span>  * @fileoverview 百度地图的自定义信息窗口，对外开放。
<span class="line">  3</span>  * 用户自定义信息窗口的各种样式。例如：border，margin，padding，color，background等
<span class="line">  4</span>  * 主入口类是&lt;a href="symbols/BMapLib.InfoBox.html"&gt;InfoBox&lt;/a&gt;，
<span class="line">  5</span>  * 基于Baidu Map API 1.2。
<span class="line">  6</span>  *
<span class="line">  7</span>  * @author Baidu Map Api Group
<span class="line">  8</span>  * @version 1.2
<span class="line">  9</span>  */</span><span class="WHIT">
<span class="line"> 10</span> </span><span class="COMM">/**
<span class="line"> 11</span>  * @namespace BMap的所有library类均放在BMapLib命名空间下
<span class="line"> 12</span>  */</span><span class="WHIT">
<span class="line"> 13</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">BMapLib</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">window.BMapLib</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">BMapLib</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 14</span> </span><span class="COMM">//常量，infoBox可以出现的位置，此版本只可实现上下两个方向。</span><span class="WHIT">
<span class="line"> 15</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">INFOBOX_AT_TOP</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">INFOBOX_AT_RIGHT</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">INFOBOX_AT_BOTTOM</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">3</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">INFOBOX_AT_LEFT</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">4</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 16</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line"> 17</span> </span><span class="WHIT">    </span><span class="COMM">//声明baidu包</span><span class="WHIT">
<span class="line"> 18</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">T</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">baidu</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">T</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">version</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'1.5.0'</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 19</span> </span><span class="WHIT">    </span><span class="NAME">baidu.guid</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'$BAIDU$'</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 20</span> </span><span class="WHIT">    </span><span class="COMM">//以下方法为百度Tangram框架中的方法，请到http://tangram.baidu.com 查看文档</span><span class="WHIT">
<span class="line"> 21</span> </span><span class="WHIT">    </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line"> 22</span> </span><span class="WHIT">        </span><span class="NAME">window</span><span class="PUNC">[</span><span class="NAME">baidu.guid</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">window</span><span class="PUNC">[</span><span class="NAME">baidu.guid</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 23</span> 
<span class="line"> 24</span> </span><span class="WHIT">		</span><span class="NAME">baidu.lang</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.lang</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 25</span> </span><span class="WHIT">        </span><span class="NAME">baidu.lang.isString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">source</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line"> 26</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="STRN">'[object String]'</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">Object.prototype.toString.call</span><span class="PUNC">(</span><span class="NAME">source</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 27</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 28</span> </span><span class="WHIT">        </span><span class="NAME">baidu.lang.isFunction</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">source</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line"> 29</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="STRN">'[object Function]'</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">Object.prototype.toString.call</span><span class="PUNC">(</span><span class="NAME">source</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 30</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 31</span> </span><span class="WHIT">        </span><span class="NAME">baidu.lang.Event</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line"> 32</span> </span><span class="WHIT">            </span><span class="NAME">this.type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 33</span> </span><span class="WHIT">            </span><span class="NAME">this.returnValue</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 34</span> </span><span class="WHIT">            </span><span class="NAME">this.target</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">target</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 35</span> </span><span class="WHIT">            </span><span class="NAME">this.currentTarget</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 36</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 37</span> 
<span class="line"> 38</span> 
<span class="line"> 39</span> </span><span class="WHIT">        </span><span class="NAME">baidu.object</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.object</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 40</span> </span><span class="WHIT">        </span><span class="NAME">baidu.extend</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT">
<span class="line"> 41</span> </span><span class="WHIT">        </span><span class="NAME">baidu.object.extend</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line"> 42</span> </span><span class="WHIT">            </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">p</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line"> 43</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">source.hasOwnProperty</span><span class="PUNC">(</span><span class="NAME">p</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line"> 44</span> </span><span class="WHIT">                    </span><span class="NAME">target</span><span class="PUNC">[</span><span class="NAME">p</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">[</span><span class="NAME">p</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 45</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class="line"> 46</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class="line"> 47</span> 
<span class="line"> 48</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 49</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 50</span> </span><span class="WHIT">        </span><span class="NAME">baidu.event</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.event</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 51</span> </span><span class="WHIT">        </span><span class="NAME">baidu.event._listeners</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.event._listeners</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 52</span> </span><span class="WHIT">        </span><span class="NAME">baidu.dom</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.dom</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 53</span> 
<span class="line"> 54</span> </span><span class="WHIT">        </span><span class="NAME">baidu.dom._g</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line"> 55</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">baidu.lang.isString</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line"> 56</span> </span><span class="WHIT">                </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">document.getElementById</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 57</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class="line"> 58</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">id</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 59</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 60</span> </span><span class="WHIT">        </span><span class="NAME">baidu._g</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.dom._g</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 61</span> </span><span class="WHIT">        </span><span class="NAME">baidu.event.on</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">listener</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line"> 62</span> </span><span class="WHIT">            </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">type.replace</span><span class="PUNC">(</span><span class="REGX">/^on/i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 63</span> </span><span class="WHIT">            </span><span class="NAME">element</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.dom._g</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 64</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">realListener</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">ev</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line"> 65</span> </span><span class="WHIT">                    </span><span class="COMM">// 1. 这里不支持EventArgument,  原因是跨frame的事件挂载</span><span class="WHIT">
<span class="line"> 66</span> </span><span class="WHIT">                    </span><span class="COMM">// 2. element是为了修正this</span><span class="WHIT">
<span class="line"> 67</span> </span><span class="WHIT">                    </span><span class="NAME">listener.call</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ev</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 68</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class="line"> 69</span> </span><span class="WHIT">                </span><span class="NAME">lis</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.event._listeners</span><span class="PUNC">,</span><span class="WHIT">
<span class="line"> 70</span> </span><span class="WHIT">                </span><span class="NAME">filter</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.event._eventFilter</span><span class="PUNC">,</span><span class="WHIT">
<span class="line"> 71</span> </span><span class="WHIT">                </span><span class="NAME">afterFilter</span><span class="PUNC">,</span><span class="WHIT">
<span class="line"> 72</span> </span><span class="WHIT">                </span><span class="NAME">realType</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 73</span> </span><span class="WHIT">            </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">type.toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 74</span> </span><span class="WHIT">            </span><span class="COMM">// filter过滤</span><span class="WHIT">
<span class="line"> 75</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">filter</span><span class="WHIT"> </span><span class="PUNC">&amp;&amp;</span><span class="WHIT"> </span><span class="NAME">filter</span><span class="PUNC">[</span><span class="NAME">type</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line"> 76</span> </span><span class="WHIT">                </span><span class="NAME">afterFilter</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">filter</span><span class="PUNC">[</span><span class="NAME">type</span><span class="PUNC">]</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">realListener</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 77</span> </span><span class="WHIT">                </span><span class="NAME">realType</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">afterFilter.type</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 78</span> </span><span class="WHIT">                </span><span class="NAME">realListener</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">afterFilter.listener</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 79</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class="line"> 80</span> 
<span class="line"> 81</span> </span><span class="WHIT">            </span><span class="COMM">// 事件监听器挂载</span><span class="WHIT">
<span class="line"> 82</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">element.addEventListener</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line"> 83</span> </span><span class="WHIT">                </span><span class="NAME">element.addEventListener</span><span class="PUNC">(</span><span class="NAME">realType</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">realListener</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 84</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">element.attachEvent</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line"> 85</span> </span><span class="WHIT">                </span><span class="NAME">element.attachEvent</span><span class="PUNC">(</span><span class="STRN">'on'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">realType</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">realListener</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 86</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class="line"> 87</span> </span><span class="WHIT">            </span><span class="COMM">// 将监听器存储到数组中</span><span class="WHIT">
<span class="line"> 88</span> </span><span class="WHIT">            </span><span class="NAME">lis</span><span class="PUNC">[</span><span class="NAME">lis.length</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NAME">element</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">listener</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">realListener</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">realType</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 89</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">element</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 90</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 91</span> 
<span class="line"> 92</span> </span><span class="WHIT">        </span><span class="NAME">baidu.on</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.event.on</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 93</span> </span><span class="WHIT">        </span><span class="NAME">baidu.event.un</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">listener</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line"> 94</span> </span><span class="WHIT">            </span><span class="NAME">element</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.dom._g</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 95</span> </span><span class="WHIT">            </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">type.replace</span><span class="PUNC">(</span><span class="REGX">/^on/i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line"> 96</span> 
<span class="line"> 97</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">lis</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.event._listeners</span><span class="PUNC">,</span><span class="WHIT">
<span class="line"> 98</span> </span><span class="WHIT">                </span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">lis.length</span><span class="PUNC">,</span><span class="WHIT">
<span class="line"> 99</span> </span><span class="WHIT">                </span><span class="NAME">isRemoveAll</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">listener</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">100</span> </span><span class="WHIT">                </span><span class="NAME">item</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">101</span> </span><span class="WHIT">                </span><span class="NAME">realType</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">realListener</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">102</span> </span><span class="WHIT">            </span><span class="KEYW">while</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">len</span><span class="PUNC">--</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">103</span> </span><span class="WHIT">                </span><span class="NAME">item</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">lis</span><span class="PUNC">[</span><span class="NAME">len</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">104</span> 
<span class="line">105</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">item</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">type</span><span class="WHIT">
<span class="line">106</span> </span><span class="WHIT">                    </span><span class="PUNC">&amp;&amp;</span><span class="WHIT"> </span><span class="NAME">item</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">element</span><span class="WHIT">
<span class="line">107</span> </span><span class="WHIT">                    </span><span class="PUNC">&amp;&amp;</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">isRemoveAll</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">item</span><span class="PUNC">[</span><span class="NUMB">2</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">listener</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">108</span> </span><span class="WHIT">                   	</span><span class="NAME">realType</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">item</span><span class="PUNC">[</span><span class="NUMB">4</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">109</span> </span><span class="WHIT">                   	</span><span class="NAME">realListener</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">item</span><span class="PUNC">[</span><span class="NUMB">3</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">110</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">element.removeEventListener</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">111</span> </span><span class="WHIT">                        </span><span class="NAME">element.removeEventListener</span><span class="PUNC">(</span><span class="NAME">realType</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">realListener</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">112</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">element.detachEvent</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">113</span> </span><span class="WHIT">                        </span><span class="NAME">element.detachEvent</span><span class="PUNC">(</span><span class="STRN">'on'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">realType</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">realListener</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">114</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">115</span> </span><span class="WHIT">                    </span><span class="NAME">lis.splice</span><span class="PUNC">(</span><span class="NAME">len</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">116</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">117</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">118</span> 
<span class="line">119</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">element</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">120</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">121</span> </span><span class="WHIT">        </span><span class="NAME">baidu.un</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.event.un</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">122</span> </span><span class="WHIT">        </span><span class="NAME">baidu.dom.g</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">123</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="STRN">'string'</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">id</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">id</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">String</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">124</span> </span><span class="WHIT">                </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">document.getElementById</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">125</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">id</span><span class="WHIT"> </span><span class="PUNC">&amp;&amp;</span><span class="WHIT"> </span><span class="NAME">id.nodeName</span><span class="WHIT"> </span><span class="PUNC">&amp;&amp;</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">id.nodeType</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">id.nodeType</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">9</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">126</span> </span><span class="WHIT">                </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">id</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">127</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">128</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">129</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">130</span> </span><span class="WHIT">        </span><span class="NAME">baidu.g</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.G</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.dom.g</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">131</span> </span><span class="WHIT">        </span><span class="NAME">baidu.dom._styleFixer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.dom._styleFixer</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">132</span> </span><span class="WHIT">        </span><span class="NAME">baidu.dom._styleFilter</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.dom._styleFilter</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">133</span> </span><span class="WHIT">        </span><span class="NAME">baidu.dom._styleFilter.filter</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">method</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">134</span> </span><span class="WHIT">            </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">filters</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.dom._styleFilter</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">filter</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">filter</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">filters</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">135</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">filter</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">filter</span><span class="PUNC">[</span><span class="NAME">method</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">136</span> </span><span class="WHIT">                    </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">filter</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">137</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">138</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">139</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">140</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">141</span> </span><span class="WHIT">        </span><span class="NAME">baidu.string</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.string</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">142</span> 
<span class="line">143</span> </span><span class="WHIT">        </span><span class="NAME">baidu.string.toCamelCase</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">source</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">144</span> </span><span class="WHIT">            </span><span class="COMM">//提前判断，提高getStyle等的效率 thanks xianwei</span><span class="WHIT">
<span class="line">145</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">source.indexOf</span><span class="PUNC">(</span><span class="STRN">'-'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">&amp;&amp;</span><span class="WHIT"> </span><span class="NAME">source.indexOf</span><span class="PUNC">(</span><span class="STRN">'_'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">146</span> </span><span class="WHIT">                </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">147</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">148</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">source.replace</span><span class="PUNC">(</span><span class="REGX">/[-_][^-_]/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">match</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">149</span> </span><span class="WHIT">                </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">match.charAt</span><span class="PUNC">(</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">toUpperCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">150</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">151</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">152</span> 
<span class="line">153</span> </span><span class="WHIT">        </span><span class="NAME">baidu.dom.setStyle</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">154</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">dom</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.dom</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">fixer</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">155</span> 
<span class="line">156</span> </span><span class="WHIT">            </span><span class="COMM">// 放弃了对firefox 0.9的opacity的支持</span><span class="WHIT">
<span class="line">157</span> </span><span class="WHIT">            </span><span class="NAME">element</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">dom.g</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">158</span> </span><span class="WHIT">            </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.string.toCamelCase</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">159</span> 
<span class="line">160</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">fixer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">dom._styleFilter</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">161</span> </span><span class="WHIT">                </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">fixer.filter</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'set'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">162</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">163</span> 
<span class="line">164</span> </span><span class="WHIT">            </span><span class="NAME">fixer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">dom._styleFixer</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">165</span> </span><span class="WHIT">            </span><span class="PUNC">(</span><span class="NAME">fixer</span><span class="WHIT"> </span><span class="PUNC">&amp;&amp;</span><span class="WHIT"> </span><span class="NAME">fixer.set</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">fixer.set</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">element.style</span><span class="PUNC">[</span><span class="NAME">fixer</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">166</span> 
<span class="line">167</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">element</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">168</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">169</span> 
<span class="line">170</span> </span><span class="WHIT">         </span><span class="NAME">baidu.setStyle</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.dom.setStyle</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">171</span> 
<span class="line">172</span> </span><span class="WHIT">        </span><span class="NAME">baidu.dom.setStyles</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">styles</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">173</span> </span><span class="WHIT">            </span><span class="NAME">element</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.dom.g</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">174</span> </span><span class="WHIT">            </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">styles</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">175</span> </span><span class="WHIT">                </span><span class="NAME">baidu.dom.setStyle</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">styles</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">176</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">177</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">element</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">178</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">179</span> </span><span class="WHIT">         </span><span class="NAME">baidu.setStyles</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.dom.setStyles</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">180</span> </span><span class="WHIT">        </span><span class="NAME">baidu.browser</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.browser</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">181</span> </span><span class="WHIT">        </span><span class="NAME">baidu.browser.ie</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.ie</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="REGX">/msie (\d+\.\d+)/i</span><span class="PUNC">.</span><span class="NAME">test</span><span class="PUNC">(</span><span class="NAME">navigator.userAgent</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">document.documentMode</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">RegExp</span><span class="PUNC">[</span><span class="STRN">'\x241'</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">182</span> </span><span class="WHIT">        </span><span class="NAME">baidu.dom._NAME_ATTRS</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">183</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">184</span> </span><span class="WHIT">                </span><span class="STRN">'cellpadding'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'cellPadding'</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">185</span> </span><span class="WHIT">                </span><span class="STRN">'cellspacing'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'cellSpacing'</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">186</span> </span><span class="WHIT">                </span><span class="STRN">'colspan'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'colSpan'</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">187</span> </span><span class="WHIT">                </span><span class="STRN">'rowspan'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'rowSpan'</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">188</span> </span><span class="WHIT">                </span><span class="STRN">'valign'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'vAlign'</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">189</span> </span><span class="WHIT">                </span><span class="STRN">'usemap'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'useMap'</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">190</span> </span><span class="WHIT">                </span><span class="STRN">'frameborder'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'frameBorder'</span><span class="WHIT">
<span class="line">191</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">192</span> 
<span class="line">193</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">baidu.browser.ie</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">8</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">194</span> </span><span class="WHIT">                </span><span class="NAME">result</span><span class="PUNC">[</span><span class="STRN">'for'</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'htmlFor'</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">195</span> </span><span class="WHIT">                </span><span class="NAME">result</span><span class="PUNC">[</span><span class="STRN">'class'</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'className'</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">196</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">197</span> </span><span class="WHIT">                </span><span class="NAME">result</span><span class="PUNC">[</span><span class="STRN">'htmlFor'</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'for'</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">198</span> </span><span class="WHIT">                </span><span class="NAME">result</span><span class="PUNC">[</span><span class="STRN">'className'</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'class'</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">199</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">200</span> 
<span class="line">201</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">result</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">202</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">203</span> </span><span class="WHIT">        </span><span class="NAME">baidu.dom.setAttr</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">204</span> </span><span class="WHIT">            </span><span class="NAME">element</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.dom.g</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">205</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="STRN">'style'</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">206</span> </span><span class="WHIT">                </span><span class="NAME">element.style.cssText</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">207</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">208</span> </span><span class="WHIT">                </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.dom._NAME_ATTRS</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">209</span> </span><span class="WHIT">                </span><span class="NAME">element.setAttribute</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">210</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">211</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">element</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">212</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">213</span> </span><span class="WHIT">         </span><span class="NAME">baidu.setAttr</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.dom.setAttr</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">214</span> </span><span class="WHIT">        </span><span class="NAME">baidu.dom.setAttrs</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">attributes</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">215</span> </span><span class="WHIT">            </span><span class="NAME">element</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.dom.g</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">216</span> </span><span class="WHIT">            </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">attributes</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">217</span> </span><span class="WHIT">                </span><span class="NAME">baidu.dom.setAttr</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">attributes</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">218</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">219</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">element</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">220</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">221</span> </span><span class="WHIT">        </span><span class="NAME">baidu.setAttrs</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.dom.setAttrs</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">222</span> </span><span class="WHIT">        </span><span class="NAME">baidu.dom.create</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">tagName</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">opt_attributes</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">223</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">el</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.createElement</span><span class="PUNC">(</span><span class="NAME">tagName</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">224</span> </span><span class="WHIT">                </span><span class="NAME">attributes</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opt_attributes</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">225</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">baidu.dom.setAttrs</span><span class="PUNC">(</span><span class="NAME">el</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">attributes</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">226</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">227</span> </span><span class="WHIT">        </span><span class="NAME">T.undope</span><span class="PUNC">=</span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">228</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">229</span> 
<span class="line">230</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class="line">231</span>      * @exports InfoBox as BMapLib.InfoBox
<span class="line">232</span>      */</span><span class="WHIT">
<span class="line">233</span> 
<span class="line">234</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">InfoBox</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT">
<span class="line">235</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class="line">236</span>      * InfoBox类的构造函数
<span class="line">237</span>      * @class InfoBox &lt;b&gt;入口&lt;/b&gt;。
<span class="line">238</span>      * 可以自定义border,margin,padding,关闭按钮等等。
<span class="line">239</span>      * @constructor
<span class="line">240</span>          * @param {Map} map Baidu map的实例对象.
<span class="line">241</span>          * @param {String} content infoBox中的内容.
<span class="line">242</span>          * @param {Json Object} opts 可选的输入参数，非必填项。可输入选项包括：&lt;br /&gt;
<span class="line">243</span>          * {&lt;br /&gt;"&lt;b&gt;offset&lt;/b&gt;" : {Size} infoBox的偏移量
<span class="line">244</span>          * &lt;br /&gt;"&lt;b&gt;boxClass&lt;/b&gt;" : {String} 定义infoBox的class,
<span class="line">245</span>          * &lt;br /&gt;"&lt;b&gt;boxStyle&lt;/b&gt;" : {Json} 定义infoBox的style,此项会覆盖boxClass&lt;br /&gt;
<span class="line">246</span>          * &lt;br /&gt;"&lt;b&gt;closeIconMargin&lt;/b&gt;" : {String} 关闭按钮的margin    &lt;br /&gt;
<span class="line">247</span>          * &lt;br /&gt;"&lt;b&gt;closeIconUrl&lt;/b&gt;" : {String} 关闭按钮的url地址    &lt;br /&gt;
<span class="line">248</span>          * &lt;br /&gt;"&lt;b&gt;enableAutoPan&lt;/b&gt;" : {Boolean} 是否启动自动平移功能    &lt;br /&gt;
<span class="line">249</span>          * &lt;br /&gt;"&lt;b&gt;align&lt;/b&gt;" : {Number} 基于哪个位置进行定位，取值为[INFOBOX_AT_TOP,INFOBOX_AT_BOTTOM]&lt;br /&gt;
<span class="line">250</span>          * }&lt;br /&gt;.
<span class="line">251</span>          * @example &lt;b&gt;参考示例：&lt;/b&gt;&lt;br /&gt;
<span class="line">252</span>          * var infoBox = new BMapLib.InfoBox(map,"百度地图api",{boxStyle:{background:"url('tipbox.gif') no-repeat
<span class="line">253</span>           center top",width: "200px"},closeIconMargin: "10px 2px 0 0",enableAutoPan: true
<span class="line">254</span>           ,alignBottom: false});
<span class="line">255</span>      */</span><span class="WHIT">
<span class="line">256</span> </span><span class="WHIT">        </span><span class="NAME">BMapLib.InfoBox</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">map</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">content</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">opts</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">257</span> 
<span class="line">258</span> </span><span class="WHIT">        </span><span class="NAME">this._content</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">content</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">259</span> </span><span class="WHIT">        </span><span class="NAME">this._isOpen</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">260</span> </span><span class="WHIT">        </span><span class="NAME">this._map</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">map</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">261</span> 
<span class="line">262</span> </span><span class="WHIT">        </span><span class="NAME">this._opts</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opts</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opts</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">263</span> </span><span class="WHIT">        </span><span class="NAME">this._opts.offset</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT">  </span><span class="NAME">opts.offset</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">BMap.Size</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">264</span> </span><span class="WHIT">        </span><span class="NAME">this._opts.boxClass</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opts.boxClass</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">"infoBox"</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">265</span> </span><span class="WHIT">        </span><span class="NAME">this._opts.boxStyle</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opts.boxStyle</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">266</span> </span><span class="WHIT">        </span><span class="NAME">this._opts.closeIconMargin</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opts.closeIconMargin</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">"2px"</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">267</span> </span><span class="WHIT">        </span><span class="NAME">this._opts.closeIconUrl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opts.closeIconUrl</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">"close.png"</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">268</span> </span><span class="WHIT">        </span><span class="NAME">this._opts.enableAutoPan</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opts.enableAutoPan</span><span class="WHIT">  </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">269</span> </span><span class="WHIT">        </span><span class="NAME">this._opts.align</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opts.align</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">INFOBOX_AT_TOP</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">270</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">271</span> </span><span class="WHIT">    </span><span class="NAME">InfoBox.prototype</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">BMap.Overlay</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">272</span> </span><span class="WHIT">    </span><span class="NAME">InfoBox.prototype.initialize</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">map</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">273</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">me</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">274</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">div</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._div</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">baidu.dom.create</span><span class="PUNC">(</span><span class="STRN">'div'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="STRN">"class"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this._opts.boxClass</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">275</span> </span><span class="WHIT">        </span><span class="NAME">baidu.dom.setStyles</span><span class="PUNC">(</span><span class="NAME">div</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this._opts.boxStyle</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">276</span> </span><span class="WHIT">        </span><span class="COMM">//设置position为absolute，用于定位</span><span class="WHIT">
<span class="line">277</span> </span><span class="WHIT">        </span><span class="NAME">div.style.position</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"absolute"</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">278</span> </span><span class="WHIT">        </span><span class="NAME">this._setContent</span><span class="PUNC">(</span><span class="NAME">this._content</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">279</span> 
<span class="line">280</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">floatPane</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">map.getPanes</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">floatPane</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">281</span> </span><span class="WHIT">        </span><span class="NAME">floatPane.style.width</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"auto"</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">282</span> </span><span class="WHIT">        </span><span class="NAME">floatPane.appendChild</span><span class="PUNC">(</span><span class="NAME">div</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">283</span> </span><span class="WHIT">        </span><span class="COMM">//设置完内容后，获取div的宽度,高度</span><span class="WHIT">
<span class="line">284</span> </span><span class="WHIT">        </span><span class="NAME">this._getInfoBoxSize</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">285</span> </span><span class="WHIT">        </span><span class="COMM">//this._boxWidth = parseInt(this._div.offsetWidth,10);</span><span class="WHIT">
<span class="line">286</span> </span><span class="WHIT">        </span><span class="COMM">//this._boxHeight = parseInt(this._div.offsetHeight,10);</span><span class="WHIT">
<span class="line">287</span> </span><span class="WHIT">        </span><span class="COMM">//阻止各种冒泡事件</span><span class="WHIT">
<span class="line">288</span> </span><span class="WHIT">        </span><span class="NAME">baidu.event.on</span><span class="PUNC">(</span><span class="NAME">div</span><span class="PUNC">,</span><span class="STRN">"onmousedown"</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">289</span> </span><span class="WHIT">            </span><span class="NAME">me._stopBubble</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">290</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">291</span> </span><span class="WHIT">        </span><span class="NAME">baidu.event.on</span><span class="PUNC">(</span><span class="NAME">div</span><span class="PUNC">,</span><span class="STRN">"onmouseover"</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">292</span> </span><span class="WHIT">            </span><span class="NAME">me._stopBubble</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">293</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">294</span> </span><span class="WHIT">        </span><span class="NAME">baidu.event.on</span><span class="PUNC">(</span><span class="NAME">div</span><span class="PUNC">,</span><span class="STRN">"click"</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">295</span> </span><span class="WHIT">            </span><span class="NAME">me._stopBubble</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">296</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">297</span> </span><span class="WHIT">        </span><span class="NAME">baidu.event.on</span><span class="PUNC">(</span><span class="NAME">div</span><span class="PUNC">,</span><span class="STRN">"dblclick"</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">298</span> </span><span class="WHIT">            </span><span class="NAME">me._stopBubble</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">299</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">300</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">div</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">301</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">302</span> </span><span class="WHIT">    </span><span class="NAME">InfoBox.prototype.draw</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">303</span> </span><span class="WHIT">        </span><span class="NAME">this._isOpen</span><span class="WHIT"> </span><span class="PUNC">&amp;&amp;</span><span class="WHIT"> </span><span class="NAME">this._adjustPosition</span><span class="PUNC">(</span><span class="NAME">this._point</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">304</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">305</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class="line">306</span>      * 打开infoBox
<span class="line">307</span>      * @param {Marker|Point} anchor 要在哪个marker或者point上打开infobox
<span class="line">308</span>      * @return none
<span class="line">309</span>      *
<span class="line">310</span>      * @example &lt;b&gt;参考示例：&lt;/b&gt;&lt;br /&gt;
<span class="line">311</span>      * infoBox.open();
<span class="line">312</span>      */</span><span class="WHIT">
<span class="line">313</span> </span><span class="WHIT">    </span><span class="NAME">InfoBox.prototype.open</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">anchor</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">314</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">me</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="NAME">poi</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">315</span> </span><span class="WHIT">        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">this._isOpen</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">316</span> </span><span class="WHIT">            </span><span class="NAME">this._map.addOverlay</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">317</span> </span><span class="WHIT">            </span><span class="NAME">this._isOpen</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">318</span> </span><span class="WHIT">            </span><span class="COMM">//延迟10ms派发open事件，使后绑定的事件可以触发。</span><span class="WHIT">
<span class="line">319</span> </span><span class="WHIT">            </span><span class="NAME">setTimeout</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">320</span> </span><span class="WHIT">                </span><span class="NAME">me._dispatchEvent</span><span class="PUNC">(</span><span class="NAME">me</span><span class="PUNC">,</span><span class="STRN">"open"</span><span class="PUNC">,</span><span class="PUNC">{</span><span class="STRN">"point"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">me._point</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">321</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="NUMB">10</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">322</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">323</span> </span><span class="WHIT">        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">anchor</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">BMap.Point</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">324</span> </span><span class="WHIT">            </span><span class="NAME">poi</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">anchor</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">325</span> </span><span class="WHIT">            </span><span class="COMM">//清除之前存在的marker事件绑定，如果存在的话</span><span class="WHIT">
<span class="line">326</span> </span><span class="WHIT">            </span><span class="NAME">this._removeMarkerEvt</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">327</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">anchor</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">BMap.Marker</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">328</span> </span><span class="WHIT">        	</span><span class="COMM">//如果当前marker不为空，说明是第二个marker，或者第二次点open按钮,先移除掉之前绑定的事件</span><span class="WHIT">
<span class="line">329</span> </span><span class="WHIT">        	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this._marker</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">330</span> </span><span class="WHIT">        		</span><span class="NAME">this._removeMarkerEvt</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">331</span> </span><span class="WHIT">        	</span><span class="PUNC">}</span><span class="WHIT">
<span class="line">332</span> </span><span class="WHIT">            </span><span class="NAME">poi</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">anchor.getPosition</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">333</span> </span><span class="WHIT">            </span><span class="NAME">this._marker</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">anchor</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">334</span> </span><span class="WHIT">            </span><span class="PUNC">!</span><span class="NAME">this._markerDragend</span><span class="WHIT"> </span><span class="PUNC">&amp;&amp;</span><span class="WHIT"> </span><span class="NAME">this._marker.addEventListener</span><span class="PUNC">(</span><span class="STRN">"dragend"</span><span class="PUNC">,</span><span class="NAME">this._markerDragend</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">335</span> </span><span class="WHIT">            	</span><span class="NAME">me._point</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e.point</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">336</span> </span><span class="WHIT">            	</span><span class="NAME">me._adjustPosition</span><span class="PUNC">(</span><span class="NAME">me._point</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">337</span> </span><span class="WHIT">            	</span><span class="NAME">me._panBox</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">338</span> </span><span class="WHIT">            	</span><span class="NAME">me.show</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">339</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">340</span> </span><span class="WHIT">             </span><span class="COMM">//给marker绑定dragging事件，拖动marker的时候，infoBox也跟随移动</span><span class="WHIT">
<span class="line">341</span> </span><span class="WHIT">            </span><span class="PUNC">!</span><span class="NAME">this._markerDragging</span><span class="WHIT"> </span><span class="PUNC">&amp;&amp;</span><span class="WHIT"> </span><span class="NAME">this._marker.addEventListener</span><span class="PUNC">(</span><span class="STRN">"dragging"</span><span class="PUNC">,</span><span class="NAME">this._markerDragging</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">342</span> </span><span class="WHIT">            	</span><span class="NAME">me.hide</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">343</span> </span><span class="WHIT">            	</span><span class="NAME">me._point</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">me._marker.getPosition</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">344</span> </span><span class="WHIT">                </span><span class="NAME">me._adjustPosition</span><span class="PUNC">(</span><span class="NAME">me._point</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">345</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">346</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">347</span> </span><span class="WHIT">        </span><span class="COMM">//打开的时候，将infowindow显示</span><span class="WHIT">
<span class="line">348</span> </span><span class="WHIT">        </span><span class="NAME">this.show</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">349</span> </span><span class="WHIT">        </span><span class="NAME">this._point</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">poi</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">350</span> </span><span class="WHIT">        </span><span class="NAME">this._panBox</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">351</span> </span><span class="WHIT">        </span><span class="NAME">this._adjustPosition</span><span class="PUNC">(</span><span class="NAME">this._point</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">352</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">353</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class="line">354</span>      * 关闭infoBox
<span class="line">355</span>      * @return none
<span class="line">356</span>      *
<span class="line">357</span>      * @example &lt;b&gt;参考示例：&lt;/b&gt;&lt;br /&gt;
<span class="line">358</span>      * infoBox.close();
<span class="line">359</span>      */</span><span class="WHIT">
<span class="line">360</span> </span><span class="WHIT">    </span><span class="NAME">InfoBox.prototype.close</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">361</span> </span><span class="WHIT">        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this._isOpen</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">362</span> </span><span class="WHIT">            </span><span class="NAME">this._map.removeOverlay</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">363</span> </span><span class="WHIT">            </span><span class="NAME">this._isOpen</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">364</span> </span><span class="WHIT">            </span><span class="NAME">this._dispatchEvent</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="STRN">"close"</span><span class="PUNC">,</span><span class="PUNC">{</span><span class="STRN">"point"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this._point</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">365</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">366</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">367</span> 
<span class="line">368</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class="line">369</span>    	 * 打开infoBox时，派发事件的接口
<span class="line">370</span>      * @name InfoBox#Open
<span class="line">371</span>      * @event
<span class="line">372</span>      * @param {Event Object} e 回调函数会返回event参数，包括以下返回值：
<span class="line">373</span>      * &lt;br /&gt;{"&lt;b&gt;target&lt;/b&gt; : {BMap.Overlay} 触发事件的元素,
<span class="line">374</span>      * &lt;br /&gt;"&lt;b&gt;type&lt;/b&gt;：{String} 事件类型,
<span class="line">375</span>      * &lt;br /&gt;"&lt;b&gt;point&lt;/b&gt;：{Point} infoBox的打开位置}
<span class="line">376</span>      *
<span class="line">377</span>      * @example &lt;b&gt;参考示例：&lt;/b&gt;
<span class="line">378</span>      * infoBox.addEventListener("open", function(e) {
<span class="line">379</span>      *     alert(e.type);
<span class="line">380</span>      * });
<span class="line">381</span>      */</span><span class="WHIT">
<span class="line">382</span> </span><span class="WHIT">   </span><span class="COMM">/**
<span class="line">383</span>    	 * 关闭infoBox时，派发事件的接口
<span class="line">384</span>      * @name InfoBox#Close
<span class="line">385</span>      * @event
<span class="line">386</span>      * @param {Event Object} e 回调函数会返回event参数，包括以下返回值：
<span class="line">387</span>      * &lt;br /&gt;{"&lt;b&gt;target&lt;/b&gt; : {BMap.Overlay} 触发事件的元素,
<span class="line">388</span>      * &lt;br /&gt;"&lt;b&gt;type&lt;/b&gt;：{String} 事件类型,
<span class="line">389</span>      * &lt;br /&gt;"&lt;b&gt;point&lt;/b&gt;：{Point} infoBox的关闭位置}
<span class="line">390</span>      *
<span class="line">391</span>      * @example &lt;b&gt;参考示例：&lt;/b&gt;
<span class="line">392</span>      * infoBox.addEventListener("close", function(e) {
<span class="line">393</span>      *     alert(e.type);
<span class="line">394</span>      * });
<span class="line">395</span>      */</span><span class="WHIT">
<span class="line">396</span> </span><span class="WHIT">  </span><span class="COMM">/**
<span class="line">397</span>      * 启用自动平移
<span class="line">398</span>      * @return none
<span class="line">399</span>      *
<span class="line">400</span>      * @example &lt;b&gt;参考示例：&lt;/b&gt;&lt;br /&gt;
<span class="line">401</span>      * infoBox.enableAutoPan();
<span class="line">402</span>      */</span><span class="WHIT">
<span class="line">403</span> </span><span class="WHIT">    </span><span class="NAME">InfoBox.prototype.enableAutoPan</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">404</span> </span><span class="WHIT">        </span><span class="NAME">this._opts.enableAutoPan</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">405</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">406</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class="line">407</span>      * 禁用自动平移
<span class="line">408</span>      * @return none
<span class="line">409</span>      *
<span class="line">410</span>      * @example &lt;b&gt;参考示例：&lt;/b&gt;&lt;br /&gt;
<span class="line">411</span>      * infoBox.disableAutoPan();
<span class="line">412</span>      */</span><span class="WHIT">
<span class="line">413</span> </span><span class="WHIT">    </span><span class="NAME">InfoBox.prototype.disableAutoPan</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">414</span> </span><span class="WHIT">        </span><span class="NAME">this._opts.enableAutoPan</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">415</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">416</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class="line">417</span>      * 设置infoBox的内容
<span class="line">418</span>      * @param {String|HTMLElement} content 弹出气泡中的内容
<span class="line">419</span>      * @return none
<span class="line">420</span>      *
<span class="line">421</span>      * @example &lt;b&gt;参考示例：&lt;/b&gt;&lt;br /&gt;
<span class="line">422</span>      * infoBox.setContent("百度地图API");
<span class="line">423</span>      */</span><span class="WHIT">
<span class="line">424</span> </span><span class="WHIT">    </span><span class="NAME">InfoBox.prototype.setContent</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">content</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">425</span> </span><span class="WHIT">      	</span><span class="NAME">this._setContent</span><span class="PUNC">(</span><span class="NAME">content</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">426</span> </span><span class="WHIT">      	</span><span class="NAME">this._getInfoBoxSize</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">427</span> </span><span class="WHIT">        </span><span class="NAME">this._adjustPosition</span><span class="PUNC">(</span><span class="NAME">this._point</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">428</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">429</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class="line">430</span>      * 设置信息窗的地理位置
<span class="line">431</span>      * @param {Point} point 设置position
<span class="line">432</span>      * @return none
<span class="line">433</span>      *
<span class="line">434</span>      * @example &lt;b&gt;参考示例：&lt;/b&gt;&lt;br /&gt;
<span class="line">435</span>      * infoBox.setPosition(new BMap.Point(116.35,39.911));
<span class="line">436</span>      */</span><span class="WHIT">
<span class="line">437</span> </span><span class="WHIT">    </span><span class="NAME">InfoBox.prototype.setPosition</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">poi</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">438</span> </span><span class="WHIT">        </span><span class="NAME">this._point</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">poi</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">439</span> </span><span class="WHIT">        </span><span class="NAME">this._adjustPosition</span><span class="PUNC">(</span><span class="NAME">poi</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">440</span> </span><span class="WHIT">        </span><span class="NAME">this._removeMarkerEvt</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">441</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">442</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class="line">443</span>      * 获得信息窗的地理位置
<span class="line">444</span>      * @param none
<span class="line">445</span>      * @return {Point} 信息窗的地理坐标
<span class="line">446</span>      *
<span class="line">447</span>      * @example &lt;b&gt;参考示例：&lt;/b&gt;&lt;br /&gt;
<span class="line">448</span>      * infoBox.getPosition();
<span class="line">449</span>      */</span><span class="WHIT">
<span class="line">450</span> </span><span class="WHIT">    </span><span class="NAME">InfoBox.prototype.getPosition</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">451</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this._point</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">452</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">453</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class="line">454</span>      * 返回信息窗口的箭头距离信息窗口在地图
<span class="line">455</span>      * 上所锚定的地理坐标点的像素偏移量。
<span class="line">456</span>      * @return {Size} Size
<span class="line">457</span>      *
<span class="line">458</span>      * @example &lt;b&gt;参考示例：&lt;/b&gt;&lt;br /&gt;
<span class="line">459</span>      * infoBox.getOffset();
<span class="line">460</span>      */</span><span class="WHIT">
<span class="line">461</span> </span><span class="WHIT">    </span><span class="NAME">InfoBox.prototype.getOffset</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">462</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this._opts.offset</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">463</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">464</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class="line">465</span>    	 *@ignore
<span class="line">466</span>      * 删除overlay，调用Map.removeOverlay时将调用此方法，
<span class="line">467</span>      * 将移除覆盖物的容器元素
<span class="line">468</span>      */</span><span class="WHIT">
<span class="line">469</span> </span><span class="WHIT">    </span><span class="NAME">InfoBox.prototype.remove</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">470</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">me</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">471</span> </span><span class="WHIT">        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this.domElement</span><span class="WHIT"> </span><span class="PUNC">&amp;&amp;</span><span class="WHIT"> </span><span class="NAME">this.domElement.parentNode</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">472</span> </span><span class="WHIT">          </span><span class="COMM">//防止内存泄露</span><span class="WHIT">
<span class="line">473</span> </span><span class="WHIT">          </span><span class="NAME">baidu.event.un</span><span class="PUNC">(</span><span class="NAME">this._div.firstChild</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"click"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">me._closeHandler</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">474</span> </span><span class="WHIT">          </span><span class="NAME">this.domElement.parentNode.removeChild</span><span class="PUNC">(</span><span class="NAME">this.domElement</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">475</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">476</span> </span><span class="WHIT">        </span><span class="NAME">this.domElement</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">477</span> </span><span class="WHIT">        </span><span class="NAME">this._isOpen</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">478</span> </span><span class="WHIT">        </span><span class="NAME">this.dispatchEvent</span><span class="PUNC">(</span><span class="STRN">"onremove"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">479</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">480</span> </span><span class="WHIT">    </span><span class="NAME">baidu.object.extend</span><span class="PUNC">(</span><span class="NAME">InfoBox.prototype</span><span class="PUNC">,</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">481</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class="line">482</span>          * 获取关闭按钮的html
<span class="line">483</span>          * @return IMG 关闭按钮的HTML代码
<span class="line">484</span>          */</span><span class="WHIT">
<span class="line">485</span> </span><span class="WHIT">        </span><span class="NAME">_getCloseIcon</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">486</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">img</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"&lt;img src='"</span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this._opts.closeIconUrl</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="STRN">"' align='right' style='position:relative;right:0px;cursor:pointer;margin:"</span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this._opts.closeIconMargin</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="STRN">"'/&gt;"</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">487</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">img</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">488</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">489</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class="line">490</span> 	     * 设置infoBox的内容
<span class="line">491</span> 	     * @param {String|HTMLElement} content 弹出气泡中的内容
<span class="line">492</span> 	     * @return none
<span class="line">493</span> 	     *
<span class="line">494</span> 	     * @example &lt;b&gt;参考示例：&lt;/b&gt;&lt;br /&gt;
<span class="line">495</span> 	     * infoBox.setContent("百度地图API");
<span class="line">496</span> 	     */</span><span class="WHIT">
<span class="line">497</span> </span><span class="WHIT">        </span><span class="NAME">_setContent</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">content</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">498</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">this._div</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">499</span> </span><span class="WHIT">	            </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">500</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">501</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">closeHtml</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._getCloseIcon</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">502</span> </span><span class="WHIT">	        </span><span class="COMM">//string类型的content</span><span class="WHIT">
<span class="line">503</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">content.nodeType</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">504</span> </span><span class="WHIT">	            </span><span class="NAME">this._div.innerHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">closeHtml</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">content</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">505</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">506</span> </span><span class="WHIT">	            </span><span class="NAME">this._div.innerHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">closeHtml</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">507</span> </span><span class="WHIT">	            </span><span class="NAME">this._div.appendChild</span><span class="PUNC">(</span><span class="NAME">content</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">508</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">509</span> </span><span class="WHIT">	        </span><span class="NAME">this._content</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">content</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">510</span> </span><span class="WHIT">	        </span><span class="COMM">//添加click关闭infobox事件</span><span class="WHIT">
<span class="line">511</span> </span><span class="WHIT">	        </span><span class="NAME">this._addEventToClose</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">512</span> 
<span class="line">513</span> </span><span class="WHIT">   	    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">514</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class="line">515</span>          * 调整infobox的position
<span class="line">516</span>          * @return none
<span class="line">517</span>          */</span><span class="WHIT">
<span class="line">518</span> </span><span class="WHIT">        </span><span class="NAME">_adjustPosition</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">poi</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">519</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">pixel</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._getPointPosition</span><span class="PUNC">(</span><span class="NAME">poi</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">520</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">icon</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._marker</span><span class="WHIT"> </span><span class="PUNC">&amp;&amp;</span><span class="WHIT"> </span><span class="NAME">this._marker.getIcon</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">521</span> </span><span class="WHIT">            </span><span class="KEYW">switch</span><span class="PUNC">(</span><span class="NAME">this._opts.align</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">522</span> </span><span class="WHIT">                </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">INFOBOX_AT_TOP</span><span class="PUNC">:</span><span class="WHIT">
<span class="line">523</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this._marker</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">524</span> </span><span class="WHIT">                        </span><span class="NAME">this._div.style.bottom</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="PUNC">(</span><span class="NAME">pixel.y</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">this._opts.offset.height</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">icon.anchor.height</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">icon.infoWindowAnchor.height</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">this._marker.getOffset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">height</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"px"</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">525</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">526</span> </span><span class="WHIT">                        </span><span class="NAME">this._div.style.bottom</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="PUNC">(</span><span class="NAME">pixel.y</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">this._opts.offset.height</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"px"</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">527</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">528</span> </span><span class="WHIT">                    </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">529</span> </span><span class="WHIT">                </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">INFOBOX_AT_BOTTOM</span><span class="PUNC">:</span><span class="WHIT">
<span class="line">530</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this._marker</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">531</span> </span><span class="WHIT">          		        </span><span class="NAME">this._div.style.top</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">pixel.y</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this._opts.offset.height</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">icon.anchor.height</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">icon.infoWindowAnchor.height</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this._marker.getOffset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">height</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"px"</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">532</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">533</span> </span><span class="WHIT">                        </span><span class="NAME">this._div.style.top</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">pixel.y</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this._opts.offset.height</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"px"</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">534</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">535</span> </span><span class="WHIT">                    </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">536</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">537</span> 
<span class="line">538</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this._marker</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">539</span> </span><span class="WHIT">                </span><span class="NAME">this._div.style.left</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">pixel.x</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">icon.anchor.width</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this._marker.getOffset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">width</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">icon.infoWindowAnchor.width</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">this._boxWidth</span><span class="WHIT"> </span><span class="PUNC">/</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"px"</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">540</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">541</span> </span><span class="WHIT">                </span><span class="NAME">this._div.style.left</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">pixel.x</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">this._boxWidth</span><span class="WHIT"> </span><span class="PUNC">/</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"px"</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">542</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">543</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">544</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class="line">545</span>          * 得到infobox的position
<span class="line">546</span>          * @return Point  infobox当前的position
<span class="line">547</span>          */</span><span class="WHIT">
<span class="line">548</span> </span><span class="WHIT">        </span><span class="NAME">_getPointPosition</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">poi</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">549</span> </span><span class="WHIT">            </span><span class="NAME">this._pointPosition</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._map.pointToOverlayPixel</span><span class="PUNC">(</span><span class="NAME">poi</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">550</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this._pointPosition</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">551</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">552</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class="line">553</span>          * 得到infobox的高度跟宽度
<span class="line">554</span>          * @return none
<span class="line">555</span>          */</span><span class="WHIT">
<span class="line">556</span> </span><span class="WHIT">        </span><span class="NAME">_getInfoBoxSize</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">557</span> </span><span class="WHIT">        	</span><span class="NAME">this._boxWidth</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">parseInt</span><span class="PUNC">(</span><span class="NAME">this._div.offsetWidth</span><span class="PUNC">,</span><span class="NUMB">10</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">558</span> </span><span class="WHIT">        	</span><span class="NAME">this._boxHeight</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">parseInt</span><span class="PUNC">(</span><span class="NAME">this._div.offsetHeight</span><span class="PUNC">,</span><span class="NUMB">10</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">559</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">560</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class="line">561</span>          * 添加关闭事件
<span class="line">562</span>          * @return none
<span class="line">563</span>          */</span><span class="WHIT">
<span class="line">564</span> </span><span class="WHIT">        </span><span class="NAME">_addEventToClose</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">565</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">me</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">566</span> </span><span class="WHIT">            </span><span class="NAME">baidu.event.on</span><span class="PUNC">(</span><span class="NAME">this._div.firstChild</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"click"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">me._closeHandler</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">567</span> </span><span class="WHIT">            </span><span class="NAME">this._hasBindEventClose</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">568</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">569</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class="line">570</span>          * 处理关闭事件
<span class="line">571</span>          * @return none
<span class="line">572</span>          */</span><span class="WHIT">
<span class="line">573</span> </span><span class="WHIT">        </span><span class="NAME">_closeHandler</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">574</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">me</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">575</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">576</span> </span><span class="WHIT">                </span><span class="NAME">me.close</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">577</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">578</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">579</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class="line">580</span>          * 阻止事件冒泡
<span class="line">581</span>          * @return none
<span class="line">582</span>          */</span><span class="WHIT">
<span class="line">583</span> </span><span class="WHIT">        </span><span class="NAME">_stopBubble</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">584</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">&amp;&amp;</span><span class="WHIT"> </span><span class="NAME">e.stopPropagation</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">585</span> </span><span class="WHIT">                </span><span class="NAME">e.stopPropagation</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">586</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">587</span> </span><span class="WHIT">                </span><span class="NAME">window.event.cancelBubble</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">588</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">589</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">590</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class="line">591</span>          * 自动平移infobox，使其在视野中全部显示
<span class="line">592</span>          * @return none
<span class="line">593</span>          */</span><span class="WHIT">
<span class="line">594</span> </span><span class="WHIT">        </span><span class="NAME">_panBox</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">595</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">this._opts.enableAutoPan</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">596</span> </span><span class="WHIT">                </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">597</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">598</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">mapH</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">parseInt</span><span class="PUNC">(</span><span class="NAME">this._map.getContainer</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">offsetHeight</span><span class="PUNC">,</span><span class="NUMB">10</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">599</span> </span><span class="WHIT">                </span><span class="NAME">mapW</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">parseInt</span><span class="PUNC">(</span><span class="NAME">this._map.getContainer</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">offsetWidth</span><span class="PUNC">,</span><span class="NUMB">10</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">600</span> </span><span class="WHIT">                </span><span class="NAME">boxH</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._boxHeight</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">601</span> </span><span class="WHIT">                </span><span class="NAME">boxW</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._boxWidth</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">602</span> </span><span class="WHIT">            </span><span class="COMM">//infobox窗口本身的宽度或者高度超过map container</span><span class="WHIT">
<span class="line">603</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">boxH</span><span class="WHIT"> </span><span class="PUNC">&gt;=</span><span class="WHIT"> </span><span class="NAME">mapH</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">boxW</span><span class="WHIT"> </span><span class="PUNC">&gt;=</span><span class="WHIT"> </span><span class="NAME">mapW</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">604</span> </span><span class="WHIT">                </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">605</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">606</span> </span><span class="WHIT">            </span><span class="COMM">//如果point不在可视区域内</span><span class="WHIT">
<span class="line">607</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">this._map.getBounds</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">containsPoint</span><span class="PUNC">(</span><span class="NAME">this._point</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">608</span> </span><span class="WHIT">                </span><span class="NAME">this._map.setCenter</span><span class="PUNC">(</span><span class="NAME">this._point</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">609</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">610</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">anchorPos</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._map.pointToPixel</span><span class="PUNC">(</span><span class="NAME">this._point</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">611</span> </span><span class="WHIT">                </span><span class="NAME">panTop</span><span class="PUNC">,</span><span class="NAME">panBottom</span><span class="PUNC">,</span><span class="NAME">panY</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">612</span> </span><span class="WHIT">                </span><span class="COMM">//左侧超出</span><span class="WHIT">
<span class="line">613</span> </span><span class="WHIT">                </span><span class="NAME">panLeft</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">boxW</span><span class="WHIT"> </span><span class="PUNC">/</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">anchorPos.x</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">614</span> </span><span class="WHIT">                </span><span class="COMM">//右侧超出</span><span class="WHIT">
<span class="line">615</span> </span><span class="WHIT">                </span><span class="NAME">panRight</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">boxW</span><span class="WHIT"> </span><span class="PUNC">/</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">anchorPos.x</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">mapW</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">616</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this._marker</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">617</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">icon</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._marker.getIcon</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">618</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">619</span> </span><span class="WHIT">            </span><span class="COMM">//基于bottom定位，也就是infoBox在上方的情况</span><span class="WHIT">
<span class="line">620</span> </span><span class="WHIT">            </span><span class="KEYW">switch</span><span class="PUNC">(</span><span class="NAME">this._opts.align</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">621</span> </span><span class="WHIT">                </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">INFOBOX_AT_TOP</span><span class="PUNC">:</span><span class="WHIT">
<span class="line">622</span> </span><span class="WHIT">                    </span><span class="COMM">//上侧超出</span><span class="WHIT">
<span class="line">623</span> </span><span class="WHIT">                    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">h</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._marker</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">icon.anchor.height</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this._marker.getOffset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">height</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">icon.infoWindowAnchor.height</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">624</span> </span><span class="WHIT">                    </span><span class="NAME">panTop</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">boxH</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">anchorPos.y</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this._opts.offset.height</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">h</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT">
<span class="line">625</span> </span><span class="WHIT">                    </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">626</span> </span><span class="WHIT">                </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">INFOBOX_AT_BOTTOM</span><span class="PUNC">:</span><span class="WHIT">
<span class="line">627</span> </span><span class="WHIT">                    </span><span class="COMM">//下侧超出</span><span class="WHIT">
<span class="line">628</span> </span><span class="WHIT">                    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">h</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._marker</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NAME">icon.anchor.height</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">icon.infoWindowAnchor.height</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this._marker.getOffset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">height</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this._opts.offset.height</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">629</span> </span><span class="WHIT">                    </span><span class="NAME">panBottom</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">boxH</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">anchorPos.y</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">mapH</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">h</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NUMB">4</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">630</span> </span><span class="WHIT">                    </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">631</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">632</span> 
<span class="line">633</span> </span><span class="WHIT">            </span><span class="NAME">panX</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">panLeft</span><span class="WHIT"> </span><span class="PUNC">&gt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">panLeft</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">panRight</span><span class="WHIT"> </span><span class="PUNC">&gt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NAME">panRight</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">634</span> </span><span class="WHIT">            </span><span class="NAME">panY</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">panTop</span><span class="WHIT"> </span><span class="PUNC">&gt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">panTop</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">panBottom</span><span class="WHIT"> </span><span class="PUNC">&gt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NAME">panBottom</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">635</span> </span><span class="WHIT">            </span><span class="NAME">this._map.panBy</span><span class="PUNC">(</span><span class="NAME">panX</span><span class="PUNC">,</span><span class="NAME">panY</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">636</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">637</span> </span><span class="WHIT">        </span><span class="NAME">_removeMarkerEvt</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class="line">638</span> </span><span class="WHIT">			</span><span class="NAME">this._markerDragend</span><span class="WHIT"> </span><span class="PUNC">&amp;&amp;</span><span class="WHIT"> </span><span class="NAME">this._marker.removeEventListener</span><span class="PUNC">(</span><span class="STRN">"dragend"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this._markerDragend</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">639</span> </span><span class="WHIT">            </span><span class="NAME">this._markerDragging</span><span class="WHIT"> </span><span class="PUNC">&amp;&amp;</span><span class="WHIT"> </span><span class="NAME">this._marker.removeEventListener</span><span class="PUNC">(</span><span class="STRN">"dragging"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this._markerDragging</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">640</span> </span><span class="WHIT">            </span><span class="NAME">this._markerDragend</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._markerDragging</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">641</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class="line">642</span> </span><span class="WHIT">      	</span><span class="COMM">/**
<span class="line">643</span> 	     * 集中派发事件函数
<span class="line">644</span> 	     *
<span class="line">645</span> 	     * @private
<span class="line">646</span> 	     * @param {Object} instance 派发事件的实例
<span class="line">647</span> 	     * @param {String} type 派发的事件名
<span class="line">648</span> 	     * @param {Json} opts 派发事件里添加的参数，可选
<span class="line">649</span> 	     */</span><span class="WHIT">
<span class="line">650</span> </span><span class="WHIT">	     </span><span class="NAME">_dispatchEvent</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">instance</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">opts</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">651</span> </span><span class="WHIT">	        </span><span class="NAME">type.indexOf</span><span class="PUNC">(</span><span class="STRN">"on"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">&amp;&amp;</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"on"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">652</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">event</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">baidu.lang.Event</span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">653</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="PUNC">!</span><span class="NAME">opts</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">654</span> </span><span class="WHIT">	            </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">p</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">opts</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class="line">655</span> </span><span class="WHIT">	                </span><span class="NAME">event</span><span class="PUNC">[</span><span class="NAME">p</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opts</span><span class="PUNC">[</span><span class="NAME">p</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">656</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">657</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">658</span> </span><span class="WHIT">	        </span><span class="NAME">instance.dispatchEvent</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">659</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="WHIT">
<span class="line">660</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">661</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class="line">662</span> 
<span class="line">663</span> </span></pre></body></html>